home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-tcmasp.adb < prev    next >
Text File  |  1996-01-30  |  3KB  |  60 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --  S Y S T E M . T A S K _ C L O C K . M A C H I N E _ S P E C I F I C S   --
  6. --                                                                          --
  7. --                                  B o d y                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.9 $                             --
  10. --                                                                          --
  11. --       Copyright (c) 1991,1992,1993,1994, FSU, All Rights Reserved        --
  12. --                                                                          --
  13. -- GNARL is free software; you can redistribute it  and/or modify it  under --
  14. -- terms  of  the  GNU  Library General Public License  as published by the --
  15. -- Free Software  Foundation;  either version 2, or (at  your  option)  any --
  16. -- later  version.  GNARL is distributed  in the hope that  it will be use- --
  17. -- ful, but but WITHOUT ANY WARRANTY;  without even the implied warranty of --
  18. -- MERCHANTABILITY  or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. -- eral Library Public License  for more details.  You should have received --
  20. -- a  copy of the GNU Library General Public License along with GNARL;  see --
  21. -- file COPYING.LIB.  If not,  write to the  Free Software Foundation,  675 --
  22. -- Mass Ave, Cambridge, MA 02139, USA.                                      --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  This package provides target machine specific Clock related definitions.
  27. --  Portability of System.Task_Clock package is accomplished separating
  28. --  this child package out. We only need to modify this package for
  29. --  different targets.
  30.  
  31. --  This version of Clock uses the time() function, which is available
  32. --  in most C libraries.  This is the "universal" version; it is
  33. --  only accurate to 1 second and is not the same time base used by
  34. --  the tasking library System.Real_Time.Clock and delays, but will
  35. --  work on systems without tasking or POSIX.
  36.  
  37. with Interfaces.C; use Interfaces.C;
  38.  
  39. package body System.Task_Clock.Machine_Specifics is
  40.  
  41.    -----------
  42.    -- Clock --
  43.    -----------
  44.  
  45.    function Clock return Stimespec is
  46.  
  47.       function gnat_time return long;
  48.       pragma Import (C, gnat_time);
  49.  
  50.    begin
  51.       return
  52.         Stimespec'(Val => Stimespec_Sec_Unit.Val * Time_Base (gnat_time));
  53.    end Clock;
  54.  
  55. begin
  56.    Stimespec_Ticks := Time_Of (0, 1000000);
  57.    --  Sun os 4.1 has clock resoultion of 10ms.
  58.  
  59. end System.Task_Clock.Machine_Specifics;
  60.